

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

struct SList
{
	char val;
	struct SList* next;
};

typedef struct SList SL;

SL* SLBuyNode(void)
{
	SL* newnode = (SL*)malloc(sizeof(SL));
	assert(newnode);

	newnode->val = 0;
	newnode->next = NULL;

	return newnode;
}

void SLPushBack(SL** phead, int x)
{
	assert(phead);

	if (!(*phead))
	{
		*phead = SLBuyNode();
		(*phead)->val = x;
		return;
	}

	SL* pcur = *phead;
	while (pcur->next)
	{
		pcur = pcur->next;
	}
	SL* newnode = SLBuyNode();
	newnode->val = x;
	pcur->next = newnode;
}

void SLInsert(SL* pos, int x)
{
	SL* newnode = SLBuyNode();
	newnode->val = x;
	newnode->next = pos->next;
	pos->next = newnode;
}

void SLPrint(const SL* const * phead)
{
	SL* pcur = *phead;
	while (pcur)
	{
		printf("%c", pcur->val);
		pcur = pcur->next;
	}
}

void SLDesTroy(SL** phead)
{
	assert(phead && *phead);

	SL* pcur = *phead;
	while (pcur)
	{
		SL* pnext = pcur->next;
		free(pcur);

		pcur = pnext;
	}
}

int main(void)
{
	SL* head = NULL;

	int ch = 0;

	while ((ch = getchar()) != '\n')
	{
		SLPushBack(&head, ch);
	}

	int cnt = 0;
	SL* pcur = head;
	if (pcur && (pcur->val == '-' || pcur->val == '+'))
		pcur = pcur->next;
	while (pcur)
	{
		cnt++;

		if (0 == cnt % 3 && pcur->next)
		{
			SLInsert(pcur, ',');
			pcur = pcur->next->next;
			cnt = 0;
		}
		else
			pcur = pcur->next;
	}

	SLPrint(&head);

	SLDesTroy(&head);

	return 0;
}